<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="/view/protected/templates/master.xhtml">
		<ui:define name="divMain">
			<h:form id="productsForm">
				<p:dataTable id="productsTable" value="#{productMB.allProducts}"
					var="product" emptyMessage="#{bundle.noRecords}" paginator="true"
					rows="10"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="5,10,15">
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bundle.product_name}" />
						</f:facet>
						<h:outputText value="#{product.name}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bundle.product_description}" />
						</f:facet>
						<h:outputText value="#{product.description}" />
					</p:column>
					<p:column>
						<p:commandButton value="#{bundle.detail}" icon="ui-icon-bullet"
							onclick="productDetailDialogWidget.show();"
							update=":productDetailDialogForm">
							<f:setPropertyActionListener target="#{productMB.product}"
								value="#{product}" />
						</p:commandButton>
						<p:spacer width="10px" />
						<p:commandButton value="#{bundle.button_update}"
							icon="ui-icon-pencil" update=":productUpdateDialogForm"
							onclick="productUpdateDialogWidget.show();">
							<f:setPropertyActionListener target="#{productMB.product}"
								value="#{product}" />
						</p:commandButton>
						<p:spacer width="10px" />
						<p:commandButton value="#{bundle.button_delete}"
							icon="ui-icon-trash" update=":productDeleteDialogForm"
							onclick="productDeleteDialogWidget.show();">
							<f:setPropertyActionListener target="#{productMB.product}"
								value="#{product}" />
						</p:commandButton>
					</p:column>
				</p:dataTable>
				<p:commandButton value="#{bundle.button_inserir} #{bundle.product}"
					icon="ui-icon-plus" update=":productCreateDialogForm"
					actionListener="#{productMB.resetProduct()}"
					onclick="productCreateDialogWidget.show();" />
			</h:form>
			<ui:include src="/view/protected/admin/product/productCreate.xhtml" />
			<ui:include src="/view/protected/admin/product/productDetail.xhtml" />
			<ui:include src="/view/protected/admin/product/productUpdate.xhtml" />
			<ui:include src="/view/protected/admin/product/productDelete.xhtml" />
		</ui:define>
	</ui:composition>

</h:body>
</html>